
<template>
  <el-backtop v-bind="$attrs">
    <div class="backtop-container">
      <svg viewBox="0 0 1024 1024" class="el-backtop__icon">
        <path d="M512 320L192 704h639.936z"></path>
      </svg>
      <span class="backtop-text">UP</span>
    </div>
  </el-backtop>
</template>

<script>
export default {
  name: 'BacktopWithText',
  inheritAttrs: false
}
</script>

<style scoped>
.backtop-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 50px;
  height: 50px;
  background: var(--el-color-primary);
  color: white;
  border-radius: 50%;
  box-shadow: var(--el-box-shadow-light);
  /* 增强移动端触控体验 */
  touch-action: manipulation;
  cursor: pointer;
}

/* 增加移动端点击反馈 */
.backtop-container:active {
  transform: scale(0.95);
  opacity: 0.8;
}

/* 响应式优化：在小屏幕下保持可点击性 */
@media (max-width: 768px) {
  .backtop-container {
    width: 56px;
    height: 56px;
  }
  .backtop-text {
    font-size: 13px;
  }
}

.backtop-text {
  font-size: 12px;
  font-weight: bold;
  margin-top: 2px;
}

.el-backtop__icon {
  fill: currentColor;
  width: 20px;
  height: 20px;
}

/* 在移动端放大图标 */
@media (max-width: 768px) {
  .el-backtop__icon {
    width: 24px;
    height: 24px;
  }
}
</style>
